package com.rmt.www.action;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts2.ServletActionContext;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;


import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.rmt.www.constant.ArtifactType;
import com.rmt.www.dao.ArtifactDao;
import com.rmt.www.dao.HistoryDao;
import com.rmt.www.dao.ProjectDao;
import com.rmt.www.dao.TraceabilityDao;
import com.rmt.www.dao.UserDao;
import com.rmt.www.service.HistoryService;
import com.rmt.www.vo.Artifact;
import com.rmt.www.vo.DesignArtifactHistory;
import com.rmt.www.vo.FeatureArtifact;
import com.rmt.www.vo.FeatureArtifactHistory;
import com.rmt.www.vo.History;
import com.rmt.www.vo.ImplementationArtifactHistory;
import com.rmt.www.vo.Project;
import com.rmt.www.vo.RequirementArtifactHistory;
import com.rmt.www.vo.TestArtifactHistory;
import com.rmt.www.vo.Traceability;
import com.rmt.www.vo.User;


public class HistoryAction extends ActionSupport{
	private static final long serialVersionUID = 1L;
	private int aid;
	private String artifacttype;
	private List<FeatureArtifactHistory> featureArtifactHistoryList;
	private List<RequirementArtifactHistory> requirementArtifactHistoryList;
	private List<DesignArtifactHistory> designArtifactHistoryList;
	private List<ImplementationArtifactHistory> implementationArtifactHistoryList;
	private List<TestArtifactHistory> testArtifactHistoryList;
	private HistoryService historyService;
	
	public int getAid() {
		return aid;
	}
	public void setAid(int aid) {
		this.aid = aid;
	}
	public String execute(){
		if (artifacttype.equalsIgnoreCase(ArtifactType.FEATURE)) {
			featureArtifactHistoryList = historyService.getFeatureHistoryList(aid);
		} else if (artifacttype.equalsIgnoreCase(ArtifactType.REQUIREMENT)) {
			requirementArtifactHistoryList = historyService.getRequirementHistoryList(aid);
		} else if (artifacttype.equalsIgnoreCase(ArtifactType.DESIGN)) {
			designArtifactHistoryList = historyService.getDesignHistoryList(aid);
		} else if (artifacttype.equalsIgnoreCase(ArtifactType.IMPLEMENTATION)) {
			implementationArtifactHistoryList = historyService.getImplementationHistory(aid);
		} else if (artifacttype.equalsIgnoreCase(ArtifactType.TESTCASE)) {
			testArtifactHistoryList = historyService.getTestArtifactHistory(aid);
		}
		
		return "success";
	}
	public List<FeatureArtifactHistory> getFeatureArtifactHistoryList() {
		return featureArtifactHistoryList;
	}
	public void setFeatureArtifactHistoryList(
			List<FeatureArtifactHistory> featureArtifactHistoryList) {
		this.featureArtifactHistoryList = featureArtifactHistoryList;
	}
	public List<RequirementArtifactHistory> getRequirementArtifactHistoryList() {
		return requirementArtifactHistoryList;
	}
	public void setRequirementArtifactHistoryList(
			List<RequirementArtifactHistory> requirementArtifactHistoryList) {
		this.requirementArtifactHistoryList = requirementArtifactHistoryList;
	}
	public List<DesignArtifactHistory> getDesignArtifactHistoryList() {
		return designArtifactHistoryList;
	}
	public void setDesignArtifactHistoryList(
			List<DesignArtifactHistory> designArtifactHistoryList) {
		this.designArtifactHistoryList = designArtifactHistoryList;
	}
	public List<TestArtifactHistory> getTestArtifactHistoryList() {
		return testArtifactHistoryList;
	}
	public void setTestArtifactHistoryList(
			List<TestArtifactHistory> testArtifactHistoryList) {
		this.testArtifactHistoryList = testArtifactHistoryList;
	}
	public HistoryService getHistoryService() {
		return historyService;
	}
	public void setHistoryService(HistoryService historyService) {
		this.historyService = historyService;
	}
	public String getArtifacttype() {
		return artifacttype;
	}
	public void setArtifacttype(String artifacttype) {
		this.artifacttype = artifacttype;
	}
	public List<ImplementationArtifactHistory> getImplementationArtifactHistoryList() {
		return implementationArtifactHistoryList;
	}
	public void setImplementationArtifactHistoryList(
			List<ImplementationArtifactHistory> implementationArtifactHistoryList) {
		this.implementationArtifactHistoryList = implementationArtifactHistoryList;
	}
}
